package com.atguigu.mock.entity;

import com.atguigu.common.base.entity.AutoIdBase;
import com.atguigu.common.comment.Comment;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import java.time.LocalDateTime;

@Entity
@Getter
@Setter
@NoArgsConstructor
@Comment(value = "部门表")
public class Department extends AutoIdBase {

    @Comment("部门名称")
    private String departmentName;
    @Comment("部门级别")
    private Integer departmentLevel;

    @Comment("上级部门ID")
    @ManyToOne(cascade = {CascadeType.MERGE, CascadeType.REFRESH})
    private Department superiorDepartment;

    public Department(LocalDateTime createTime, String departmentName, Integer departmentLevel, Department superiorDepartment) {
        super(createTime);
        this.departmentName = departmentName;
        this.departmentLevel = departmentLevel;
        this.superiorDepartment = superiorDepartment;
    }
}
